package com.molichuxing.services.infrastructure.dao;

import com.molichuxing.framework.dao.RootMapper;
import com.molichuxing.services.infrastructure.bean.LoginLogBean;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface LoginLogMapper extends RootMapper<LoginLogBean> {
    /**
     * 根据经销商id获取登陆日志总数
     * @param map
     * @return
     */
    Integer getLoginLogCount(@Param("map") Map<String, Object> map);

    /**
     * 根据经销商id获取登陆日志记录
     * @param map
     * @param pageNum
     * @param pageSize
     * @return
     */
    List<LoginLogBean> getLoginLogByDealerId(@Param("map") Map<String, Object> map, @Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize);

    /**
     * 获取用户最后一次登录时间
     *
     * @return
     */
    LoginLogBean getAccountLastTimeByIdAndType(@Param("accountId") int accountId, @Param("type") int type);

    List<LoginLogBean> getLogByAccountAndType(@Param("account") String account, @Param("type") Integer type);

    int updateAccountLogOutTime(@Param("account") String account);

    /**
     * 根据条件分页查询count
     *
     * @param params
     * @return
     */
    long getPageCount(@Param("params") Map<String, Object> params);

    /**
     * 根据条件分页查询
     *
     * @param params
     * @param pageNum
     * @param pageSize
     * @return
     */
    List<LoginLogBean> getPage(@Param("params") Map<String, Object> params, @Param("pageNum") int pageNum,
                               @Param("pageSize") int pageSize);
}